{% extends 'base.html' %}
{% block content %}
<div class="card">
  <h2>{{ '编辑' if deposit else '添加' }}存款业务</h2>
  <form method="POST">
    <div class="form-group">
      <label>存款编号</label>  <!-- ✅ 更明确名称 -->
      <input type="text" name="depositID" value="{{ deposit.depositID if deposit else '' }}" {% if deposit %}readonly{% endif %} required>
    </div>
    <div class="form-group">
      <label>存款名称</label>
      <input type="text" name="name" value="{{ deposit.name if deposit else '' }}" required>
    </div>
    <div class="form-group">
      <label>存款描述</label>
      <input type="text" name="description" value="{{ deposit.description if deposit else '' }}">
    </div>

    <!-- ✅ 新增客户编号选择 -->
    <div class="form-group">
      <label>客户编号</label>
      <select name="customerID" required>
        <option value="">请选择客户</option>
        {% for customer in customers %}
        <option value="{{ customer.customerID }}"
          {% if deposit and deposit.customerID == customer.customerID %}selected{% endif %}>
          {{ customer.customerID }} - {{ customer.customerName }}
        </option>
        {% endfor %}
      </select>
    </div>

    <button type="submit" class="btn">提交</button>
    <a href="{{ url_for('deposits') }}" class="btn">返回</a>
  </form>
</div>
{% endblock %}
